package com.example.gateway.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

import java.util.HashMap;

/**
 * @author benjamin_5
 * @Description
 * @date 2023/2/16
 */
public class AuthResultUtil {

    public static String buildResult(int code, String message){
        HashMap<String, Object> resMap = new HashMap<>();
        resMap.put("code", code);
        resMap.put("message", message);
        resMap.put("data", null);
        // 允许输出空值
        return JSON.toJSONString(resMap, SerializerFeature.WriteMapNullValue);
    }
}
